//logs.js
// var util = require('../../utils/util.js')
// ['1'=>'手动挡','2'=>'自动挡','3'=>'手自一体']
var app = getApp()
var user  = require('../../utils/user.js')
Page({
  data: {
    imgUrls: [
      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
    ],
    imageurl:'http://api.shsytour.cn',
    array: {1: '有',2: '无'},
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000
  },
  caravanBtnSure:function(event){
    var url = '/pages/list/orderinfo?id=' + event.target.dataset.id + '&sdate=' + event.target.dataset.sdate + '&edate=' + event.target.dataset.edate
    if (user.checkLogin()) {
      wx.navigateTo({
        url: url
      })
    }else{
      wx.navigateTo({
        url: '/pages/login/login?url=' + url
      })
    }
  },
  onLoad:function(options){
    var that = this
    var caralltypes = wx.getStorageSync('$caralltypes')
    app.getJson('/wxapp/caravan/info',{'id':options.id},function(res){
      that.setData({
        pis: res.data.piccaravan,
        caravaninfo: res.data,
        caralltypes: caralltypes,
        sdate:options.sdate,
        edate:options.edate
      })
    })
  },
  showPic:function(e) {
    console.log(e.target.dataset.url)
    wx.previewImage({
      current: e.target.dataset.url, // 当前显示图片的http链接
      urls: this.data.pis.map(function(pic){
        return 'http://api.shsytour.cn' + pic
      }) // 需要预览的图片http链接列表
    })
  }
})
